package com.wewins.fota.bean.dto;

import com.github.pagehelper.PageInfo;
import lombok.Builder;
import lombok.Data;

import java.util.List;

@Data
@Builder
public class PageRst<T> {
    private int pageNum;
    private int pageSize;
    private long totalSize;
    private int totalPages;
    private List<T> data;

    public PageRst<T> fillBy(PageInfo<T> pageInfo) {
        this.pageNum = pageInfo.getPageNum();
        this.pageSize = pageInfo.getPageSize();
        this.totalSize = pageInfo.getTotal();
        this.totalPages = pageInfo.getPages();
        this.data = pageInfo.getList();
        return this;
    }
}
